package com.ruoyi.applet.appletRegion.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.annotation.Excel;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @描述:
 * @Author: TangYuan
 * @Date: 2024/12/31 11:46
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Region implements Serializable {
    
    private static final long serialVersionUID = 1L;
    
    /** 地区代码 */
    private Long value;
    
    /** 地区名称 */
    @Excel(name = "地区名称")
    private String text;
    
    /** 子列表 */
    private List<Region> children = new ArrayList<>();
    
    public Region(AppletRegion appletRegion) {
        this.value = appletRegion.getId();
        this.text = appletRegion.getExtName();
    }
    
    public Long getValue() {
        return value;
    }
    
    public void setValue(Long value) {
        this.value = value;
    }
    
    public String getText() {
        return text;
    }
    
    public void setText(String text) {
        this.text = text;
    }
    
    public List<Region> getChildren() {
        return children;
    }
    
    public void setChildren(List<Region> children) {
        this.children = children;
    }
    
    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("value", value)
                .append("text", text)
                .append("children", children)
                .toString();
    }
}
